-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add PSA stack #424
feat: add PSA stack #424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM though my personal knowledge of old web3 storage is not sufficient to tell if this is the right place to look for car files + hashes.
psa/config.js
Outdated
export const buckets = [ | ||
{ | ||
name: process.env.S3_DOTSTORAGE_0_BUCKET_NAME, | ||
region: process.env.S3_DOTSTORAGE_0_BUCKET_REGION, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this just the names we have 0 & 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for historical reasons we had 2 buckets that received some pinning service data. They are in different regions.
psa/functions/download.js
Outdated
} | ||
|
||
try { | ||
const url = await getDownloadURL(buckets, root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buckes doesn't need an import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It certainly does!
downloadFunction.attachPermissions(['s3:GetObject']) | ||
|
||
stack.addOutputs({ | ||
hashFunctionURL: hashFunction.url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these need a domain name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good shout - otherwise they will change when we deploy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to have to setup a redirect for this manually since we want to allow execution of >30s (hashing big files). The AWS API gateway has a limit of 30s, which I think is now configurable, but I don't think our SST version supports it yet.
bbfce5c
to
38e91d4
Compare
View stack outputs
|
Adds a temporary stack for the old Pinning Service API (PSA) data.
The stack creates 2 functions:
hash
given a root CID, find a CAR file in one of the configured buckets and calculate it's hash.download
given a root CID, find a CAR file in one of the configured buckets and return a signed URL allowing temporary access to the data.This is for the PSA migration tool in console.
hash
.blob/add
CAR file.download
to get a signed URL and then download the data, and upload it to Storacha.